package com.lagou.controller;

import com.alibaba.fastjson.JSON;
import com.lagou.Vo.Result;
import com.lagou.bean.Person;
import com.lagou.service.Neo4jPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.UUID;

/**
 * @author zjy
 * @date: 2020/7/4 12:15 下午
 */
@Controller
public class DemoController {

    @Autowired
    Neo4jPersonService neo4jPersonService;

    @RequestMapping("/home")
    public String toLoginPage(Model model){
        return "home";
    }


    @RequestMapping("/demo/findAll")
    @ResponseBody
    public Result findAll(@RequestParam("startName")String startName,@RequestParam("endName")String endName,@RequestParam("isShortPath")Boolean isShortPath){
        System.out.println("st>>>>" + startName);
        System.out.println("endName>>>>" + endName);
        System.out.println("isShortPath>>>>" + isShortPath);
        Result result = neo4jPersonService.getAllPersonByStartNameAndName(startName, endName,isShortPath);
        System.out.println(JSON.toJSON(result));
        return result;
    }


}
